{layout name="layout" /}
<script type="text/javascript" charset="utf-8" src="{$Think.config.Ueditor}ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="{$Think.config.Ueditor}ueditor.all.min.js">
</script>
<script type="text/javascript">
	var ue = UE.getEditor('editor', {
		autoHeightEnabled: true,
		autoFloatEnabled: true,
		initialFrameHeight: 500
	});
	ue.addListener("ready", function() {
		// editor准备好之后才可以使用
		// ue .setContent('{$article->content}');
	});
</script>

<!-- Content -->
<section id="content" class="container">
	<!-- Breadcrumb -->
	{include file="public/breadcrumb"/}
	<form action="{:url('back/article/edit',['id'=>$article['id']])}" enctype="multipart/form-data" method="post">
		<h4 class="page-title">添加文章</h4>
		<div class="block-area" id="text-input">
			<div class="col-md-12 m-t-15">
				<select name="category_id" class="form-control">
					<option>--请选择文章分类--</option>
					{volist name="catrows" id="catrows"}
					<option value="{$catrows.id}" {if condition="$article->category_id eq $catrows.id" } selected="selected" {/if}>{$catrows.title}</option>
					{volist name="$catrows->parent" id="row"}
					<option value="{$row.id}" {if condition="$article->category_id eq $row.id" } selected="selected" {/if}>┗━{$row.title}</option>
					{volist name="$row->parent" id="r"}
					<option value="{$r.id}" {if condition="$article->category_id eq $r.id" } selected="selected" {/if}>&nbsp;&nbsp;┗━━━{$r.title}</option>
					{/volist} {/volist} {/volist}
				</select>
			</div>
		</div>
		<div class="block-area" id="text-input">

			<p>标题</p>
			<input class="form-control input-focused" name="title" type="text" value="{$article.title}">
			<hr class="whiter m-t-20" />

			<div class="fileupload fileupload-new" data-provides="fileupload">
				<div class="fileupload-new thumbnail small form-control">
					<img src="{$article.thumbnail}">
				</div>
				<div class="fileupload-preview form-control fileupload-exists thumbnail small">
					<img src="{$article.thumbnail}">
				</div>
				<span class="btn btn-file btn-alt btn-sm">
                            <span class="fileupload-new">选择缩略图</span>
				<span class="fileupload-exists">替换</span>
				<input type="file" name="image" />

				</span>
				<a href="#" class="btn-sm btn fileupload-exists" data-dismiss="fileupload">移除</a>
			</div>
			<hr class="whiter m-t-20" />
			<p>描述</p>
			<input class="form-control input-focused" name="description" type="text" value="{$article.description}">
			<hr class="whiter m-t-20" />
			<p>关键字</p>
			<input class="form-control input-focused" name="keyword" type="text" value="{$article.keyword}">
			<hr class="whiter m-t-20" />
		</div>

		<!-- Buttons -->
		<div class="block-area" id="button">
			<div class="btn-group" data-toggle="buttons">

				{volist name="attr" id="attr"}
				<label class="btn btn-gr-gray btn-sm {if condition='$article->attr eq $attr.aid'}active{/if}">
                            <input type="radio" name="attr" value="{$attr.aid}" {if condition='$article->attr eq $attr.aid'}checked="checked"{/if}/> {$attr.attr_name}
                        </label> {/volist}

			</div>
		</div>

		<hr class="whiter m-t-20" />
		<!-- Text Editor -->
		<div class="block-area" style="color:#333;">
			<h3 class="block-title">内容</h3>
			<textarea id="editor" type="text/plain" name="editorValue" style="width:100%;height=300px;">{$article->content}</textarea>
		</div>
		<div class="block-area" id="button">
			<label class="btn btn-gr-gray btn-lg">
                            <input type="submit" value="更新">
                        </label>
		</div>
	</form>
</section>